package com.ruoyi.shop.homes.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.shop.homes.service.DtsHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/homes")
public class DtsHomeController  extends BaseController {

    @Autowired
    private DtsHomeService dtsHomeService;
    /**
     * 今日订单销售额
     * */
    @RequestMapping("/todaySales")
    public Double getTodaySales()
    {
        return dtsHomeService.getTodaySales();
    }
    /**
     * 昨日订单销售额
     * */
    @RequestMapping("/yesterdaySales")
    public Double getYesterdaySales()
    {
        return dtsHomeService.getYesterdaySales();
    }
    /**
     * 今日订单数
     * */
    @RequestMapping("/todayOrders")
    public Integer  getTodayOrders()
    {
        return dtsHomeService.getTodayOrders();
    }
    /**
     * 昨日订单数
     * */
    @RequestMapping("/yesterdayOrders")
    public Integer getYesterdayOrders()
    {
        return dtsHomeService.getYesterdayOrders();
    }
    /**
     * 用户数量
     * */
    @RequestMapping("/totalUsers")
    public Integer getTotalUsers()
    {
        return dtsHomeService.getTotalUsers();
    }
    /**
     * 商品数量
     * */
    @RequestMapping("/goodsCount")
    public Integer getGoodsCount()
    {
        return dtsHomeService.getGoodsCount();
    }

    /**
     * 订单趋势分析折线图
     * */
    @GetMapping("/salesTrend/{type}")
    public List<Map<String, Object>> getSalesTrend(@PathVariable String type) {
        return dtsHomeService.getSalesTrend(type);
    }
    /**
     * 订单状态分布饼状图
     * */
    @GetMapping("/orderStatus")
    public List<Map<String, Object>> getOrderStatus() {
        return dtsHomeService.getOrderStatus();
    }

    /**
     * 热门商品销售排行
     * */

    @GetMapping("/hotGoods")
    public List<Map<String, Object>> getHotGoods() {
        return dtsHomeService.getHotGoods();
    }

    /**
     * 热门商品销售排行
     * */

    @GetMapping("/goodsType")
    public List<Map<String, Object>> getGoodsType() {
        return dtsHomeService.getGoodsType();
    }

}
